package net.sparrow.gui.drawing;

import net.sparrow.Sparrow;

public class SpScreenCoord {

	
	protected Double x;
	protected Double y;
	public Double getX() {return x;}

	public Double getY() {return y;}
	
	public void setX(Double ix) {x = ix;}
	
	public void setY(Double iy) {y = iy;}

	protected boolean isActual = false;
	
	
	public SpScreenCoord(Double ix, Double iy) {
		x = ix;
		y = iy;
		isActual = false;
	}
	
	public SpScreenCoord(Double ix, Double iy, Boolean is) {
		this(ix, iy);
		isActual = is;
	}
	
	public boolean isActual() {
		return isActual;
	}

	public SpScreenCoord asActualCoords() {
		if ( !isActual ) {
			Double ix = x * .01; //percentage
			Double iy = y * .01; 
			return new SpScreenCoord( (ix * ((double)Sparrow.mc().screenWidth())), (iy * ((double)Sparrow.mc().screenHeight())), true);
		}
		return this;
	}
	
	public SpScreenCoord asSpCoords() {
		if( isActual ) {
			return new SpScreenCoord( (x / ((double)Sparrow.mc().screenWidth())), (y / ((double)Sparrow.mc().screenHeight())));
		}
		return this;
	}
}
